    /***
     *  Post a new comment baby
     ***/
    function postComment(obj,pid,ptype,quick){
        show('loading');                
        obj.disabled = true;
        
        if(quick){
            var cname = document.getElementById('q_comment_name').value;
            var cmail = document.getElementById('q_comment_email').value;
            //var curl  = document.getElementById('q_comment_url').value;
            var ccom  = document.getElementById('q_comment_comment').value;
            var cpar  = document.getElementById('quickReplyID').value;
        }else{
            var cname = document.getElementById('comment_name').value;
            var cmail = document.getElementById('comment_email').value;
            //var curl  = document.getElementById('comment_url').value;
            var ccom  = document.getElementById('comment_comment').value;
            var cpar  = false;
        }
        
        (new AjaxRequest).send({
            url     : "ajax/",
            data    : {
                action: 'postComment',
                id:     pid,
                type:   ptype,
                name:   cname,
                mail:   cmail,
                //url:    curl,
                text:   ccom,
                parent: cpar
            },
            
            onSuccess  : function(data, info)
            {   
                if(data.bad_inputs){
                    alert('Please fill in all the mandatory fields!');
                    obj.disabled = false;
                }else{
                    window.location.href = thisPage+'?rand='+data.commentID+'#c'+data.commentID;
                }
                
                hide('loading');  
            }
          });
    }
    
    
    /***
     *  Quick Reply
     ***/
    function quickreply(tree) {
                
        //hide big form
        if(document.getElementById('addComment')){
            document.getElementById('addComment').style.display = 'none';
        }
        
        var replyForm = document.getElementById('quickAddComment');
		replyForm.style.display = '';
        var currentComment = document.getElementById(tree);

		var replyToField = document.getElementById('quickReplyID');
		replyToField.value = tree;
        
		currentComment.parentNode.insertBefore(replyForm, currentComment.nextSibling);
        document.getElementById('q_comment_comment').focus();
        return false;
    }